        //  node服务代码
 
        const express = require("express");
        const fs = require("fs");
        const path = require("path");
        const app = express();
         
        // 设置跨域访问
        app.use((req, res, next) => {
          res.header("Access-Control-Allow-Origin", "*");
          res.header("Access-Control-Allow-Headers", "Content-Type");
          next();
        });
        // test.js文件与当前node服务平级，随便const一个字符串，复制内容长一点
        const filePath = path.join(__dirname, "test.js");
         
        app.get("/test", (req, res) => {
          fs.readFile(filePath, (err, data) => {
         
            // 设置Content-Type为text/javascript
            res.setHeader("Content-Type", "text/javascript");
         
            res.send("data");
          });
        });
         
         
        // 设置服务器监听端口
        const port = 3000;
        app.listen(port, () => {
          console.log(`服务器运行在 http://localhost:${port}`);
        });